 //功能说明 当一个单元格有可能要被拆分时，将单元格的内容输入获取相关信息
    //2024-6-1 by hpx
    //参数说明:myCell 单元格数据,x,y单元格所在表格的偏移，my_cellObject 表格坐标信息
    function getCuttingPosition(myCell,x,y,my_cellObject)
    {

      //收集坐标时，如果单元格被切两部分，此时要生成两部分坐标域信息。下半部分要放到次页首行的位置
      let cell=myCell;
      let cellObj=my_cellObject;
      textData=cell;
      textData.text=cell.content;       
        
      myCellCanvas = document.getElementById('cellsCanvas');
      if (myCellCanvas&&textData.text!="") {
      myCellCanvas.style.left=x+"px";
      myCellCanvas.style.top =y+"px";
      myCellCanvas.width=cell.width;
      myCellCanvas.height=cell.height;    
      compressStyles();
      
      generateLinesData();
      textData.cursorVisible=false;  
      where_to_call="distributor getCuttingPosition";
      
      inMeasureAction=1;  
      console.log(`%c QQ:527 getCuttingPosition开始处理 页面可用空间：${cellObj.segmentHeight} 当前列高:${cellObj.table_cell_height}  当前表高:${tableTotalHeight}`, "color: yellow; background-color: black;");
      
          
      //测绘单元格的每行文本，参考高度为 tableObj.available_height
      measureSegment(
        true, 
        cellObj.segmentHeight,               
        cell.width,
        cell.height,
        0,//dist_pages_position_start_x
        cellObj.position_offset_y,//dist_pages_position_start_y
        0,//sour_canvas_position_start_x
        cellObj.source_canvas_start_y,//sour_canvas_position_start_y
        cellObj
      );
      
      console.log(`%c QQ:527 再次在页面起点:${cellObj.position_offset_y}, 源图起点:${cellObj.source_canvas_start_y} 绘制高度:${cellObj.max_text_height_in_cell} 补偿量:${cellObj.compensating_height} ${getCurrentTime()}`,"color:red");
      var newSegment1 = {

        segment_index: 0,
        inMeasure:inMeasure,
        debugSn:debugSN,
        cells_Dist_Start_Y:cellObj.position_offset_y,
        cells_Dist_Height:cellObj.max_text_height_in_cell,
        cells_Source_Start_Y:cellObj.source_canvas_start_y,
        sliceType:1,
        offset_X: 0,
        offset_Y: cellObj.position_offset_y,
        width: 700,
        height: cellObj.max_text_height_in_cell,
        pageOffsetY:segmentHeight,
        lineText:"",
        dataSource:`上半部分偏移 getCuttingPosition r:${cellObj.rows} c:${cellObj.columns} 补尝:${cellObj.compensating_height}`
        
        };
      
        cellObj.source_canvas_start_y+=cellObj.max_text_height_in_cell;
        cellObj.max_text_height_in_cell=cellObj.last_table_cell_height-first_line_text_height;//现在的高度，是上页的列未绘制完成的部。
        cellObj.table_cell_height=cell.height;
        if(cellObj.is_on_bottom_of_page==true)
          {
            
            cellObj.position_offset_y+=(segmentHeight+1);
            segmentHeight=Hp-1;//新的一页                        
            cellObj.segmentHeight=Hp;
          }
          else
          {
            cellObj.position_offset_y+=cellObj.max_text_height_in_cell;
          }
        
                               // segment_Info.push(newSegment1);
       //底部切割后，要补满  
        cellObj.segmentHeight-=cellObj.max_text_height_in_cell;
        cellObj.max_text_height_in_cell=(cellObj.segmentHeight-cellObj.max_text_height_in_cell);//上一行还没有完的部分，放到下一页
        //cellObj.compensating_height=cellObj.last_table_cell_height-cellObj.last_max_text_height_in_cell;
       
        console.log(`%cQQ:527 getCuttingPosition底部切割后，要补满 bottom of page :${cellObj.is_on_bottom_of_page} 当前实用列高:${cellObj.last_max_text_height_in_cell} 当前列高(${cellObj.table_cell_height}) 下面还要空间：${cellObj.compensating_height} 最近一页可用空间:${cellObj.last_segmentHeight}  当前页可用:${cellObj.segmentHeight}`,"color:Purple");
        checkDuplicateAndInsert(segment_Info, newSegment1);


        if(cellObj.is_on_bottom_of_page===true)
          {
                 //下半单元格的坐标信息
                var newSegment2 = {
                  segment_index: 0,
                  inMeasure:inMeasure,
                  debugSn:debugSN,
                  cells_Dist_Start_Y:cellObj.position_offset_y,
                  cells_Dist_Height:cellObj.compensating_height,
                  cells_Source_Start_Y:cellObj.source_canvas_start_y,
                  sliceType:1,
                  offset_X: 0,
                  offset_Y: cellObj.position_offset_y,
                  width: 700,
                  height: cellObj.compensating_height,
                  pageOffsetY:segmentHeight,
                  lineText:"",
                  dataSource:`下半部分偏移 getCuttingPosition r:${cellObj.rows} c:${cellObj.columns} 上半部文本高:${cellObj.last_max_text_height_in_cell} 下文高::${cellObj.compensating_height}`
          
               };
               cellObj.max_text_height_in_cell=(cellObj.segmentHeight-cellObj.max_text_height_in_cell);//上一行还没有完的部分，放到下一页        
               console.log(`%cQQ:527 getCuttingPosition底部切割后，要补满 bottom of page :${cellObj.is_on_bottom_of_page} 当前实用列高:${cellObj.last_max_text_height_in_cell} 当前列高(${cellObj.table_cell_height}) 下面还要空间：${cellObj.compensating_height} 最近一页可用空间:${cellObj.last_segmentHeight} `,"color:Purple");
               checkDuplicateAndInsert(segment_Info, newSegment2);

               cellObj.source_canvas_start_y+=cellObj.compensating_height;
               cellObj.position_offset_y+=cellObj.compensating_height;
               pageGlobalYPosition=cellObj.position_offset_y;
               console.log(`%cQQ:61 getCuttingPosition底部切割后，要补满 pageGlobalYPosition:${pageGlobalYPosition} bottom of page :${cellObj.is_on_bottom_of_page} 当前实用列高:${cellObj.last_max_text_height_in_cell} 当前列高(${cellObj.table_cell_height}) 下面还要空间：${cellObj.compensating_height} 最近一页可用空间:${cellObj.last_segmentHeight} `,"color:Purple");
               
          }
   

        

    }
    console.log(`%c QQ:527 getCuttingPosition处理完毕 页面可用空间：${cellObj.segmentHeight} 当前列高:${cellObj.table_cell_height}  当前表高:${tableTotalHeight}`, "color: yellow; background-color: black;");
  }
 